{% extends "student/stu_header.html" %}
{% block context %}
    <div class="page_header">
        <h3 align="center">商品购买</h3>
    </div>
    <div class="container">
        <table class="table table-hover">
            <tr>
                <th scope="col">发布学生</th>
                <th scope="col">商品名称</th>
                <th scope="col">原价</th>
                <th scope="col">现价</th>
                <th scope="col">交易地点</th>
                <th scope="col">交易</th>
            </tr>
            </thead>
            <tbody>
            {% for product in products %}
                <tr>
                    <td>{{ product.seller_id }}</td>
                    <td>{{ product.pro_name }}</td>
                    <td>{{ product.price_org }}</td>
                    <td>{{ product.price_cur }}</td>
                    <td>{{ product.location }}</td>
                    {% if product.paid == 0 %}
                        <td><button type="submit" class="btn btn-primary" onclick="window.location.href='/buy_products?pro_id={{ product.pro_id }}'">购买</button></td>
                    {% else %}
                        <td><button type="button" class="btn btn-default" disabled="disabled">售罄</button></td>
                    {% endif %}
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock context %}